package com.sz.app.oss.api.trade;

import com.sz.app.oss.constants.Permissions;
import com.sz.biz.app.web.BaseController;
import com.sz.biz.trade.goods.service.GoodsTypeService;
import com.sz.common.base.dto.ResultDto;
import com.sz.common.base.dto.TreeNode;

import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Function: 商品类别 <br>
 * Author: penghui.zheng <br>
 * Date: 2017-07-13 09:30:00
 */
@RestController
@RequestMapping("${api}/trade/goodstype")
@Api(description = " ", tags = "045、商品类别")
public class GoodsTypeController extends BaseController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    /**
     * 根据商品类别父id查询类别
     *
     * @throws Exception
     */
    @ApiOperation(value = "查询商品类别", notes = "商品类别<br>权限：" + Permissions.BIZ_MGT_BASE_TRADE)
    @ApiImplicitParams({
          })
    @RequestMapping(value = "/list", method = {RequestMethod.GET})
    public ResultDto getGoodsType() {
    	List<TreeNode> list = goodsTypeService.getGoodsType();
        ResultDto dto = new ResultDto();
        dto.setData(list);
        return dto;
    }

}
